1. /* sdmststr.cpp by K.Tsuru */
  2. // function ID 302 DRADIX
  3. /***************************************************************
  4. SDouble class
  5. It sets a value by the string such as
  6. "[+|-]ddd.ddd...[e[+|-]dd]".
  7. temp = t[th]...t[0]*DRADIX^snrdxExp
  8. v[0].v[aTail=1]...v[aHead]*DRADIX^rdxExp
  9. aHead = th+1
  10. v[0] = 0 , v[1] = t[th]...v[j] = t[aHead-j]...v[aHead] = t[0]
  11. rdxExp = aHead + snrdxExp +1
  12. ****************************************************************/
  13. #ifndef SN_H
  14. #include "sn.h"
  15. #endif
  16. void SDouble::SetString(const char* s){
  17. StringToNumber temp(s);
  18. if( temp.Sign() == 0 ){ // = 0
  19. SetZero(); return;
  20. }
  21. uint tsz = temp.Head()+1, j;
  22. valloc( tsz, 0); // sign = 0;
  23. if(temp.Type() == DEC_INT){ //SDouble=integer
  24. Reserve(tsz); //size>=tsz+1
  25. rdxExp = (int)tsz;
  26. for(j = 1; j <= min(Size()-1, tsz); j++) figure[j] = temp[tsz-j];
  27. } else {
  28. rdxExp = temp.RdxExp();
  29. //It is possible that temp.Size()>Size()(temp.Head()+1 >= Size()).
  30. for(j = 1; j < min(Size(), tsz); j++) figure[j] = temp[j];
  31. }
  32. SetSign(temp.Sign());
  33. CheckArray(302);
  34. Reform(302);
  35. }

sdmststr.cpp : last modifiled at 2017/03/17 11:10:45(1,110 bytes)
created at 2017/10/07 10:21:14
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).